package ru.st.selenium.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class ViewMoviePage extends InternalPage {

	public ViewMoviePage(PageManager pages) {
		super(pages);
	}

	@FindBy(css = ("img[alt=\"Own\"]"))
	private WebElement OwnIcon;

	@FindBy(css = ("img[alt=\"Seen\"]"))
	private WebElement SeenIcon;

	@FindBy(css = ("img[alt=\"Not own\"]"))
	private WebElement NotownIcon;

	@FindBy(css = ("img[alt=\"Unseen\"]"))
	private WebElement UnseenIcon;

	@FindBy(css = ("img[alt=\"Edit\"]"))
	private WebElement EditIcon;

	@FindBy(css = ("img[alt=\"Remove\"]"))
	private WebElement RemoveIcon;

	@FindBy(css = ("div.duration"))
	private WebElement divdurationText;

	@FindBy(css = ("h2"))
	private WebElement FilmNameText;

	public ViewMoviePage clickRemoveIcon() {
		RemoveIcon.click();
		return this;
	}

	public ViewMoviePage ensurePageLoaded() {
		super.ensurePageLoaded();
		wait.until(presenceOfElementLocated(By
				.xpath("//div[@id='content']/section/nav/ul/li[3]/div/div/a/img")));
		wait.until(presenceOfElementLocated(By
				.xpath("//div[@id='content']/section/nav/ul/li[4]/div/div/a/img")));
		return this;
	}
}
